<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background-color: aqua;
        border-radius: 50%;
        position: absolute;
        top: 0;
        left: 0;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
    <script>
      let box = document.querySelector(".box");

      // document.addEventListener("touchstart", function(e) {
      //     let X =e.touches[0].clientX;
      //     let Y =e.touches[0].clientY;
      //     box.style.left=X + "px";
      //     box.style.top=Y + "px";
      // });
      box.addEventListener("touchmove",function (e) {
          let X = e.touches[0].clientX;
          let Y = e.touches[0].clientY;
          box.style.left = X - 50 + "px";
          box.style.top = Y - 50 + "px";
          if (e.target.className === "box") {
            e.preventDefault();
          }
        },
        {
          passive: false,
        });
    </script>
  </body>
</html>
